package cn.team11.smarteye.widget;

import android.app.ProgressDialog;
import android.content.Context;
import android.os.Bundle;
import android.view.WindowManager;
import android.widget.TextView;

import cn.team11.sds.dayi.R;

/**
 * Created by Murphy on 2017/11/10.
 */

public class CustomLoadingDialog extends ProgressDialog{
    private Context mContex;
    private TextView mTipsTv;

    public CustomLoadingDialog(Context context) {
        super(context);
        this.mContex = context;
    }

    public CustomLoadingDialog(Context context, int theme) {
        super(context, theme);
        this.mContex = context;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.default_custom_progress_dialog);

        mTipsTv = (TextView) findViewById(R.id.progress_tips);

        setCanceledOnTouchOutside(false);

        WindowManager.LayoutParams params = getWindow().getAttributes();
        params.width = WindowManager.LayoutParams.WRAP_CONTENT;
        params.height = WindowManager.LayoutParams.WRAP_CONTENT;
        getWindow().setAttributes(params);

    }

    public void setLoadingTips(String msg){
        if (mTipsTv != null){
            mTipsTv.setText(msg);
        }
    }
}
